import App from './App'
import store from './store'
// #ifndef VUE3
import Vue from 'vue'
import './permission' // permission
// 底部导航栏注册
import TabBarView from '@/components/TabBarView.vue'
// 暂无数据
import NoValue from '@/components/NoValue.vue'
// 审批流程
// import Process from '@/components/Process.vue'
// 用车申请路程等
// import Distance from '@/components/Distance.vue'
// 一键审批
// import Approve from '@/components/Approve.vue'

Vue.component('TabBarView', TabBarView)
Vue.component('NoValue', NoValue)
// Vue.component('Process', Process)
// Vue.component('Distance', Distance)
// Vue.component('Approve', Approve)




//过滤器
import * as filters from '@/utils/filter.js'
Object.keys(filters).forEach(key => {
	Vue.filter(key, filters[key])
})



import uView from '@/uni_modules/uview-ui'
Vue.use(uView)

Vue.config.productionTip = false

import {
	BASE_URL
} from "@/utils/common.js"
Vue.prototype.$upLoad = BASE_URL


const dateFormat = (time, type) => {
	let date = new Date(time);
	let year = date.getFullYear();
	// 在日期格式中，月份是从0开始的，因此要加0，使用三元表达式在小于10的前面加0，以达到格式统一  如 09:11:05
	let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
	let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
	let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
	let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
	let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
	// 拼接
	if (type) {
		return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
	}

	return year + "-" + month + "-" + day;
}

Vue.prototype.$dateFormat = dateFormat

Vue.prototype.$praseStrEmpty = function(str) {
	if (typeof str === undefined || str === null) {
		return "-";
	}
	return str;
}


App.mpType = 'app'
const app = new Vue({
	store,
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif